package dao;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import entity.Emp;
import entity.Emp1;


@Repository("empDao")
public class EmpDaoImpl implements EmpDao{

	
	@Autowired
	@Qualifier("sst")
	private SqlSessionTemplate sst;
	
	
	/*
	 * 不用考虑关闭和提交事务
	 * 
	 */
	public void save(Emp e) {
		
		sst.insert("dao.EmpDao.save", e);
		
	}

	public List<Emp> findAll() {

		return sst.selectList("dao.EmpDao.findAll");
		
	}

	public Emp findById(int id) {
		return sst.selectOne("dao.EmpDao.findById",id);
	}

	public void modify(Emp e) {
		sst.update("dao.EmpDao.modify",e);
	}

	public void delete(int id) {
		
		sst.delete("dao.EmpDao.delete",id);
		
	}

	public Map findById2(int id) {
		return sst.selectOne("dao.EmpDao.findById2",id);
	}

	public Emp1 findById3(int id) {
		return sst.selectOne("dao.EmpDao.findById3",id);
	}

	

}
